import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../../res/colors.dart';

class RadioItem extends StatefulWidget {
  Function(bool)? onchange;
   RadioItem({Key? key,this.onchange}) : super(key: key);

  @override
  State<RadioItem> createState() => _RadioItemState();
}

class _RadioItemState extends State<RadioItem> {
  RxBool on = false.obs;

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
          on.value = !on.value;
          if(widget.onchange != null){
            widget.onchange!(on.value);
          }
      },
      child: Obx(() => on.value
          ? const Icon(Icons.radio_button_checked,
          color: ColorStyle.color_home, size: 20)
          : const Icon(
        Icons.radio_button_unchecked,
        size: 20,
      )) ,
    );
  }
}
